package cool.lichuan.common.util;

import com.wf.captcha.*;
import com.wf.captcha.base.Captcha;
import cool.lichuan.common.enums.CaptchaEnum;

/**
 * @author lichuan
 * @date 2021/11/24 14:29
 * @description
 */
public class CaptchaTypeUtil {

    /**
     * 创建不同类型的验证码，如需定制自行修改。文档：https://gitee.com/ele-admin/EasyCaptcha#51%E9%AA%8C%E8%AF%81%E7%A0%81%E7%B1%BB%E5%9E%8B
     *
     * @param type 验证码类型
     * @return 验证码
     */
    public static Captcha getCaptcha(CaptchaEnum type) {
        switch (type) {
            case NORMAL_GIF:
                return new GifCaptcha();
            case CHINESE:
                return new ChineseCaptcha();
            case CHINESE_GIF:
                return new ChineseGifCaptcha();
            case ARITHMETIC:
                return new ArithmeticCaptcha();
            default:
                return new SpecCaptcha();
        }
    }

    private CaptchaTypeUtil() {
    }
}
